package thinker.miracle.rabbitmq.producer;

import java.io.IOException;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.stereotype.Service;

@Service
public class MessageProducer {
    private Logger logger = LoggerFactory.getLogger(MessageProducer.class);  

    @Resource(name="amqpTemplate")  
    private AmqpTemplate amqpTemplate;  


    public void sendMessage(Object message) throws IOException {  
        logger.info("to send message:{}", message);  
        amqpTemplate.convertAndSend("queueShijj", message);  
        amqpTemplate.convertAndSend("queueShijj", message);  
       /* amqpTemplate2.convertAndSend("shijj.xxxx.wsdwd", message);  */
    }  
}